package org.uim.cricket.updater.fetch.impl;

import org.uim.cricket.updater.fetch.URLGeneratable;

public class CricInfoYearMatchesURLGenerator implements URLGeneratable {

	private String baseURL = "http://stats.espncricinfo.com/ci/engine/records/team/match_results.html";
	
	/**
	 * Creates page URL for year by year.
	 */
	@Override
	public String generateURL(String[] args) {
		StringBuilder url = new StringBuilder();
		if (args == null || args.length < 3) return null;
		
		url.append(this.baseURL).append("?");
		url.append("class=").append(args[0]).append(";");
		url.append("id=").append(args[1]).append(";");
		url.append("team=").append(args[2]).append(";");
		
		url.append("type=year");
		
		return url.toString();
	}

	public void setBaseURL(String baseURL) {
		this.baseURL = baseURL;
	}
	
	public String getBaseURL() {
		return baseURL;
	}
	
}
